/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.spadons.esmetil.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author spadons
 */
@Entity
@Table(name = "modelo_sensor")
@NamedQueries({
    @NamedQuery(name = "ModeloSensor.findAll", query = "SELECT m FROM ModeloSensor m"),
    @NamedQuery(name = "ModeloSensor.findByCodigo", query = "SELECT m FROM ModeloSensor m WHERE m.codigo = :codigo"),
    @NamedQuery(name = "ModeloSensor.findByCodigoFabricante", query = "SELECT m FROM ModeloSensor m WHERE m.codigoFabricante = :codigoFabricante"),
    @NamedQuery(name = "ModeloSensor.findByDescripcion", query = "SELECT m FROM ModeloSensor m WHERE m.descripcion = :descripcion"),
    @NamedQuery(name = "ModeloSensor.findByRangoMin", query = "SELECT m FROM ModeloSensor m WHERE m.rangoMin = :rangoMin"),
    @NamedQuery(name = "ModeloSensor.findByRangoMax", query = "SELECT m FROM ModeloSensor m WHERE m.rangoMax = :rangoMax"),
    @NamedQuery(name = "ModeloSensor.findByObservacion", query = "SELECT m FROM ModeloSensor m WHERE m.observacion = :observacion")})
public class ModeloSensor implements Serializable {
    @Column(name = "valor_pulso")
    private BigDecimal valorPulso;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "codigo")
    private Integer codigo;
    @Size(max = 45)
    @Column(name = "codigo_fabricante")
    private String codigoFabricante;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "descripcion")
    private String descripcion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "rango_min")
    private BigDecimal rangoMin;
    @Column(name = "rango_max")
    private BigDecimal rangoMax;
    @Size(max = 120)
    @Column(name = "observacion")
    private String observacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sensor")
    private List<EstacionDetalle> estacionDetalleList;
    @JoinColumn(name = "unidad_defecto", referencedColumnName = "codigo")
    @ManyToOne(optional = false)
    private Unidad unidadDefecto;
    @JoinColumn(name = "tipo_salida", referencedColumnName = "codigo")
    @ManyToOne(optional = false)
    private TipoSalida tipoSalida;
    @JoinColumn(name = "marca", referencedColumnName = "codigo")
    @ManyToOne(optional = false)
    private Marca marca;

    public ModeloSensor() {
    }

    public ModeloSensor(Integer codigo) {
        this.codigo = codigo;
    }

    public ModeloSensor(Integer codigo, String descripcion) {
        this.codigo = codigo;
        this.descripcion = descripcion;
    }

    public Integer getCodigo() {
        return codigo;
    }

    public void setCodigo(Integer codigo) {
        this.codigo = codigo;
    }

    public String getCodigoFabricante() {
        return codigoFabricante;
    }

    public void setCodigoFabricante(String codigoFabricante) {
        this.codigoFabricante = codigoFabricante;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public BigDecimal getRangoMin() {
        return rangoMin;
    }

    public void setRangoMin(BigDecimal rangoMin) {
        this.rangoMin = rangoMin;
    }

    public BigDecimal getRangoMax() {
        return rangoMax;
    }

    public void setRangoMax(BigDecimal rangoMax) {
        this.rangoMax = rangoMax;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public List<EstacionDetalle> getEstacionDetalleList() {
        return estacionDetalleList;
    }

    public void setEstacionDetalleList(List<EstacionDetalle> estacionDetalleList) {
        this.estacionDetalleList = estacionDetalleList;
    }

    public Unidad getUnidadDefecto() {
        return unidadDefecto;
    }

    public void setUnidadDefecto(Unidad unidadDefecto) {
        this.unidadDefecto = unidadDefecto;
    }

    public TipoSalida getTipoSalida() {
        return tipoSalida;
    }

    public void setTipoSalida(TipoSalida tipoSalida) {
        this.tipoSalida = tipoSalida;
    }

    public Marca getMarca() {
        return marca;
    }

    public void setMarca(Marca marca) {
        this.marca = marca;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ModeloSensor)) {
            return false;
        }
        ModeloSensor other = (ModeloSensor) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.spadons.esmetil.entities.ModeloSensor[ codigo=" + codigo + " ]";
    }

    public BigDecimal getValorPulso() {
        return valorPulso;
    }

    public void setValorPulso(BigDecimal valorPulso) {
        this.valorPulso = valorPulso;
    }
    
}
